#include "wx/wxprec.h"
#if wxUSE_XRC && wxUSE_FILEPICKERCTRL

#include "wx/xrc/xh_filepicker.h"
#include "wx/filepicker.h"

IMPLEMENT_DYNAMIC_CLASS( wxFilePickerCtrlXmlHandler, wxXmlResourceHandler )

wxFilePickerCtrlXmlHandler::wxFilePickerCtrlXmlHandler() : wxXmlResourceHandler() {
  XRC_ADD_STYLE( wxFLP_OPEN );
  XRC_ADD_STYLE( wxFLP_SAVE );
  XRC_ADD_STYLE( wxFLP_OVERWRITE_PROMPT );
  XRC_ADD_STYLE( wxFLP_FILE_MUST_EXIST );
  XRC_ADD_STYLE( wxFLP_CHANGE_DIR );
  XRC_ADD_STYLE( wxFLP_DEFAULT_STYLE );
  XRC_ADD_STYLE( wxFLP_USE_TEXTCTRL );
  AddWindowStyles();
}

wxObject *wxFilePickerCtrlXmlHandler::DoCreateResource() {
  XRC_MAKE_INSTANCE( picker, wxFilePickerCtrl )
  picker->Create( m_parentAsWindow,
                  GetID(),
                  GetParamValue( wxT( "value" ) ),
                  GetText( wxT( "message" ) ),
                  GetParamValue( wxT( "wildcard" ) ),
                  GetPosition(), GetSize(),
                  GetStyle( _T( "style" ), wxFLP_DEFAULT_STYLE ),
                  wxDefaultValidator,
                  GetName() );
  SetupWindow( picker );
  return picker;
}

bool wxFilePickerCtrlXmlHandler::CanHandle( wxXmlNode *node ) {
  return IsOfClass( node, wxT( "wxFilePickerCtrl" ) );
}

#endif // wxUSE_XRC && wxUSE_FILEPICKERCTRL
